//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_spi(SotoInternal) import SotoCore

extension CodeGuruReviewer {
    // MARK: Enums

    public enum AnalysisType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case codeQuality = "CodeQuality"
        case security = "Security"
        public var description: String { return self.rawValue }
    }

    public enum ConfigFileState: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case absent = "Absent"
        case present = "Present"
        case presentWithErrors = "PresentWithErrors"
        public var description: String { return self.rawValue }
    }

    public enum EncryptionOption: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case aoCmk = "AWS_OWNED_CMK"
        case cmCmk = "CUSTOMER_MANAGED_CMK"
        public var description: String { return self.rawValue }
    }

    public enum JobState: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case completed = "Completed"
        case deleting = "Deleting"
        case failed = "Failed"
        case pending = "Pending"
        public var description: String { return self.rawValue }
    }

    public enum ProviderType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case bitbucket = "Bitbucket"
        case codeCommit = "CodeCommit"
        case gitHub = "GitHub"
        case gitHubEnterpriseServer = "GitHubEnterpriseServer"
        case s3Bucket = "S3Bucket"
        public var description: String { return self.rawValue }
    }

    public enum Reaction: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case thumbsDown = "ThumbsDown"
        case thumbsUp = "ThumbsUp"
        public var description: String { return self.rawValue }
    }

    public enum RecommendationCategory: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case awsBestPractices = "AWSBestPractices"
        case awsCloudformationIssues = "AWSCloudFormationIssues"
        case codeInconsistencies = "CodeInconsistencies"
        case codeMaintenanceIssues = "CodeMaintenanceIssues"
        case concurrencyIssues = "ConcurrencyIssues"
        case duplicateCode = "DuplicateCode"
        case inputValidations = "InputValidations"
        case javaBestPractices = "JavaBestPractices"
        case pythonBestPractices = "PythonBestPractices"
        case resourceLeaks = "ResourceLeaks"
        case securityIssues = "SecurityIssues"
        public var description: String { return self.rawValue }
    }

    public enum RepositoryAssociationState: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case associated = "Associated"
        case associating = "Associating"
        case disassociated = "Disassociated"
        case disassociating = "Disassociating"
        case failed = "Failed"
        public var description: String { return self.rawValue }
    }

    public enum Severity: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case critical = "Critical"
        case high = "High"
        case info = "Info"
        case low = "Low"
        case medium = "Medium"
        public var description: String { return self.rawValue }
    }

    public enum VendorName: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case github = "GitHub"
        case gitlab = "GitLab"
        case nativeS3 = "NativeS3"
        public var description: String { return self.rawValue }
    }

    public enum `Type`: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case pullRequest = "PullRequest"
        case repositoryAnalysis = "RepositoryAnalysis"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct AssociateRepositoryRequest: AWSEncodableShape {
        /// Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate repository associations if there are failures and retries.
        public let clientRequestToken: String?
        /// A KMSKeyDetails object that contains:   The encryption option for this repository association. It is either owned by Amazon Web Services Key Management Service (KMS) (AWS_OWNED_CMK) or customer managed (CUSTOMER_MANAGED_CMK).   The ID of the Amazon Web Services KMS key that is associated with this repository association.
        public let kmsKeyDetails: KMSKeyDetails?
        /// The repository to associate.
        public let repository: Repository
        /// An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
        /// 					Environment, Project, or Secret). Tag
        /// 					keys are case sensitive.   An optional field known as a tag value (for example,
        /// 					111122223333, Production, or a team name).
        /// 					Omitting the tag value is the same as using an empty string. Like tag keys, tag
        /// 					values are case sensitive.
        public let tags: [String: String]?

        @inlinable
        public init(clientRequestToken: String? = AssociateRepositoryRequest.idempotencyToken(), kmsKeyDetails: KMSKeyDetails? = nil, repository: Repository, tags: [String: String]? = nil) {
            self.clientRequestToken = clientRequestToken
            self.kmsKeyDetails = kmsKeyDetails
            self.repository = repository
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 64)
            try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
            try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "^[\\w-]+$")
            try self.kmsKeyDetails?.validate(name: "\(name).kmsKeyDetails")
            try self.repository.validate(name: "\(name).repository")
            try self.tags?.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
            }
            try self.validate(self.tags, name: "tags", parent: name, max: 50)
            try self.validate(self.tags, name: "tags", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case clientRequestToken = "ClientRequestToken"
            case kmsKeyDetails = "KMSKeyDetails"
            case repository = "Repository"
            case tags = "Tags"
        }
    }

    public struct AssociateRepositoryResponse: AWSDecodableShape {
        /// Information about the repository association.
        public let repositoryAssociation: RepositoryAssociation?
        /// An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
        /// 					Environment, Project, or Secret). Tag
        /// 					keys are case sensitive.   An optional field known as a tag value (for example,
        /// 					111122223333, Production, or a team name).
        /// 					Omitting the tag value is the same as using an empty string. Like tag keys, tag
        /// 					values are case sensitive.
        public let tags: [String: String]?

        @inlinable
        public init(repositoryAssociation: RepositoryAssociation? = nil, tags: [String: String]? = nil) {
            self.repositoryAssociation = repositoryAssociation
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case repositoryAssociation = "RepositoryAssociation"
            case tags = "Tags"
        }
    }

    public struct BranchDiffSourceCodeType: AWSEncodableShape & AWSDecodableShape {
        /// The destination branch for a diff in an associated repository.
        public let destinationBranchName: String
        /// The source branch for a diff in an associated repository.
        public let sourceBranchName: String

        @inlinable
        public init(destinationBranchName: String, sourceBranchName: String) {
            self.destinationBranchName = destinationBranchName
            self.sourceBranchName = sourceBranchName
        }

        public func validate(name: String) throws {
            try self.validate(self.destinationBranchName, name: "destinationBranchName", parent: name, max: 256)
            try self.validate(self.destinationBranchName, name: "destinationBranchName", parent: name, min: 1)
            try self.validate(self.sourceBranchName, name: "sourceBranchName", parent: name, max: 256)
            try self.validate(self.sourceBranchName, name: "sourceBranchName", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case destinationBranchName = "DestinationBranchName"
            case sourceBranchName = "SourceBranchName"
        }
    }

    public struct CodeArtifacts: AWSEncodableShape & AWSDecodableShape {
        /// The S3 object key for a build artifacts .zip file that contains .jar or .class files. This is required for a code review with security analysis. For more information, see Create code reviews with GitHub Actions in the Amazon CodeGuru Reviewer User Guide.
        public let buildArtifactsObjectKey: String?
        /// The S3 object key for a source code .zip file. This is required for all code reviews.
        public let sourceCodeArtifactsObjectKey: String

        @inlinable
        public init(buildArtifactsObjectKey: String? = nil, sourceCodeArtifactsObjectKey: String) {
            self.buildArtifactsObjectKey = buildArtifactsObjectKey
            self.sourceCodeArtifactsObjectKey = sourceCodeArtifactsObjectKey
        }

        public func validate(name: String) throws {
            try self.validate(self.buildArtifactsObjectKey, name: "buildArtifactsObjectKey", parent: name, max: 1024)
            try self.validate(self.buildArtifactsObjectKey, name: "buildArtifactsObjectKey", parent: name, min: 1)
            try self.validate(self.buildArtifactsObjectKey, name: "buildArtifactsObjectKey", parent: name, pattern: "^\\S(.*\\S)?$")
            try self.validate(self.sourceCodeArtifactsObjectKey, name: "sourceCodeArtifactsObjectKey", parent: name, max: 1024)
            try self.validate(self.sourceCodeArtifactsObjectKey, name: "sourceCodeArtifactsObjectKey", parent: name, min: 1)
            try self.validate(self.sourceCodeArtifactsObjectKey, name: "sourceCodeArtifactsObjectKey", parent: name, pattern: "^\\S(.*\\S)?$")
        }

        private enum CodingKeys: String, CodingKey {
            case buildArtifactsObjectKey = "BuildArtifactsObjectKey"
            case sourceCodeArtifactsObjectKey = "SourceCodeArtifactsObjectKey"
        }
    }

    public struct CodeCommitRepository: AWSEncodableShape {
        /// The name of the Amazon Web Services CodeCommit repository. For more information, see repositoryName in the Amazon Web Services CodeCommit API Reference.
        public let name: String

        @inlinable
        public init(name: String) {
            self.name = name
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, max: 100)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^\\S[\\w.-]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct CodeReview: AWSDecodableShape {
        /// The types of analysis performed during a repository analysis or a pull request review. You can specify either Security, CodeQuality, or both.
        public let analysisTypes: [AnalysisType]?
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation that contains the reviewed source code. You can retrieve associated repository ARNs by calling ListRepositoryAssociations.
        public let associationArn: String?
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String?
        /// The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the root directory of your repository.
        public let configFileState: ConfigFileState?
        /// The time, in milliseconds since the epoch, when the code review was created.
        public let createdTimeStamp: Date?
        /// The time, in milliseconds since the epoch, when the code review was last updated.
        public let lastUpdatedTimeStamp: Date?
        /// The statistics from the code review.
        public let metrics: Metrics?
        /// The name of the code review.
        public let name: String?
        /// The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the  account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.
        public let owner: String?
        /// The type of repository that contains the reviewed code (for example, GitHub or Bitbucket).
        public let providerType: ProviderType?
        /// The pull request ID for the code review.
        public let pullRequestId: String?
        /// The name of the repository.
        public let repositoryName: String?
        /// The type of the source code for the code review.
        public let sourceCodeType: SourceCodeType?
        /// The valid code review states are:    Completed: The code review is complete.    Pending: The code review started and has not completed or failed.    Failed: The code review failed.    Deleting: The code review is being deleted.
        public let state: JobState?
        /// The reason for the state of the code review.
        public let stateReason: String?
        /// The type of code review.
        public let type: `Type`?

        @inlinable
        public init(analysisTypes: [AnalysisType]? = nil, associationArn: String? = nil, codeReviewArn: String? = nil, configFileState: ConfigFileState? = nil, createdTimeStamp: Date? = nil, lastUpdatedTimeStamp: Date? = nil, metrics: Metrics? = nil, name: String? = nil, owner: String? = nil, providerType: ProviderType? = nil, pullRequestId: String? = nil, repositoryName: String? = nil, sourceCodeType: SourceCodeType? = nil, state: JobState? = nil, stateReason: String? = nil, type: `Type`? = nil) {
            self.analysisTypes = analysisTypes
            self.associationArn = associationArn
            self.codeReviewArn = codeReviewArn
            self.configFileState = configFileState
            self.createdTimeStamp = createdTimeStamp
            self.lastUpdatedTimeStamp = lastUpdatedTimeStamp
            self.metrics = metrics
            self.name = name
            self.owner = owner
            self.providerType = providerType
            self.pullRequestId = pullRequestId
            self.repositoryName = repositoryName
            self.sourceCodeType = sourceCodeType
            self.state = state
            self.stateReason = stateReason
            self.type = type
        }

        private enum CodingKeys: String, CodingKey {
            case analysisTypes = "AnalysisTypes"
            case associationArn = "AssociationArn"
            case codeReviewArn = "CodeReviewArn"
            case configFileState = "ConfigFileState"
            case createdTimeStamp = "CreatedTimeStamp"
            case lastUpdatedTimeStamp = "LastUpdatedTimeStamp"
            case metrics = "Metrics"
            case name = "Name"
            case owner = "Owner"
            case providerType = "ProviderType"
            case pullRequestId = "PullRequestId"
            case repositoryName = "RepositoryName"
            case sourceCodeType = "SourceCodeType"
            case state = "State"
            case stateReason = "StateReason"
            case type = "Type"
        }
    }

    public struct CodeReviewSummary: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String?
        /// The time, in milliseconds since the epoch, when the code review was created.
        public let createdTimeStamp: Date?
        /// The time, in milliseconds since the epoch, when the code review was last updated.
        public let lastUpdatedTimeStamp: Date?
        /// The statistics from the code review.
        public let metricsSummary: MetricsSummary?
        /// The name of the code review.
        public let name: String?
        /// The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the  account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.
        public let owner: String?
        /// The provider type of the repository association.
        public let providerType: ProviderType?
        /// The pull request ID for the code review.
        public let pullRequestId: String?
        /// The name of the repository.
        public let repositoryName: String?
        public let sourceCodeType: SourceCodeType?
        /// The state of the code review. The valid code review states are:    Completed: The code review is complete.    Pending: The code review started and has not completed or failed.    Failed: The code review failed.    Deleting: The code review is being deleted.
        public let state: JobState?
        /// The type of the code review.
        public let type: `Type`?

        @inlinable
        public init(codeReviewArn: String? = nil, createdTimeStamp: Date? = nil, lastUpdatedTimeStamp: Date? = nil, metricsSummary: MetricsSummary? = nil, name: String? = nil, owner: String? = nil, providerType: ProviderType? = nil, pullRequestId: String? = nil, repositoryName: String? = nil, sourceCodeType: SourceCodeType? = nil, state: JobState? = nil, type: `Type`? = nil) {
            self.codeReviewArn = codeReviewArn
            self.createdTimeStamp = createdTimeStamp
            self.lastUpdatedTimeStamp = lastUpdatedTimeStamp
            self.metricsSummary = metricsSummary
            self.name = name
            self.owner = owner
            self.providerType = providerType
            self.pullRequestId = pullRequestId
            self.repositoryName = repositoryName
            self.sourceCodeType = sourceCodeType
            self.state = state
            self.type = type
        }

        private enum CodingKeys: String, CodingKey {
            case codeReviewArn = "CodeReviewArn"
            case createdTimeStamp = "CreatedTimeStamp"
            case lastUpdatedTimeStamp = "LastUpdatedTimeStamp"
            case metricsSummary = "MetricsSummary"
            case name = "Name"
            case owner = "Owner"
            case providerType = "ProviderType"
            case pullRequestId = "PullRequestId"
            case repositoryName = "RepositoryName"
            case sourceCodeType = "SourceCodeType"
            case state = "State"
            case type = "Type"
        }
    }

    public struct CodeReviewType: AWSEncodableShape {
        /// They types of analysis performed during a repository analysis or a pull request review. You can specify either Security, CodeQuality, or both.
        public let analysisTypes: [AnalysisType]?
        /// A code review that analyzes all code under a specified branch in an associated repository. The associated repository is specified using its ARN in CreateCodeReview.
        public let repositoryAnalysis: RepositoryAnalysis

        @inlinable
        public init(analysisTypes: [AnalysisType]? = nil, repositoryAnalysis: RepositoryAnalysis) {
            self.analysisTypes = analysisTypes
            self.repositoryAnalysis = repositoryAnalysis
        }

        public func validate(name: String) throws {
            try self.repositoryAnalysis.validate(name: "\(name).repositoryAnalysis")
        }

        private enum CodingKeys: String, CodingKey {
            case analysisTypes = "AnalysisTypes"
            case repositoryAnalysis = "RepositoryAnalysis"
        }
    }

    public struct CommitDiffSourceCodeType: AWSEncodableShape & AWSDecodableShape {
        /// The SHA of the destination commit used to generate a commit diff. This field is required for a pull request code review.
        public let destinationCommit: String?
        /// The SHA of the merge base of a commit.
        public let mergeBaseCommit: String?
        /// The SHA of the source commit used to generate a commit diff. This field is required for a pull request code review.
        public let sourceCommit: String?

        @inlinable
        public init(destinationCommit: String? = nil, mergeBaseCommit: String? = nil, sourceCommit: String? = nil) {
            self.destinationCommit = destinationCommit
            self.mergeBaseCommit = mergeBaseCommit
            self.sourceCommit = sourceCommit
        }

        public func validate(name: String) throws {
            try self.validate(self.destinationCommit, name: "destinationCommit", parent: name, max: 64)
            try self.validate(self.destinationCommit, name: "destinationCommit", parent: name, min: 6)
            try self.validate(self.mergeBaseCommit, name: "mergeBaseCommit", parent: name, max: 64)
            try self.validate(self.mergeBaseCommit, name: "mergeBaseCommit", parent: name, min: 6)
            try self.validate(self.sourceCommit, name: "sourceCommit", parent: name, max: 64)
            try self.validate(self.sourceCommit, name: "sourceCommit", parent: name, min: 6)
        }

        private enum CodingKeys: String, CodingKey {
            case destinationCommit = "DestinationCommit"
            case mergeBaseCommit = "MergeBaseCommit"
            case sourceCommit = "SourceCommit"
        }
    }

    public struct CreateCodeReviewRequest: AWSEncodableShape {
        /// Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.
        public let clientRequestToken: String?
        /// The name of the code review. The name of each code review in your Amazon Web Services account must be unique.
        public let name: String
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations. A code review can only be created on an associated repository. This is the ARN of the associated repository.
        public let repositoryAssociationArn: String
        /// The type of code review to create. This is specified using a CodeReviewType object. You can create a code review only of type RepositoryAnalysis.
        public let type: CodeReviewType

        @inlinable
        public init(clientRequestToken: String? = CreateCodeReviewRequest.idempotencyToken(), name: String, repositoryAssociationArn: String, type: CodeReviewType) {
            self.clientRequestToken = clientRequestToken
            self.name = name
            self.repositoryAssociationArn = repositoryAssociationArn
            self.type = type
        }

        public func validate(name: String) throws {
            try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, max: 64)
            try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, min: 1)
            try self.validate(self.clientRequestToken, name: "clientRequestToken", parent: name, pattern: "^[\\w-]+$")
            try self.validate(self.name, name: "name", parent: name, max: 100)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[a-zA-Z0-9-_]*$")
            try self.validate(self.repositoryAssociationArn, name: "repositoryAssociationArn", parent: name, max: 1600)
            try self.validate(self.repositoryAssociationArn, name: "repositoryAssociationArn", parent: name, min: 1)
            try self.validate(self.repositoryAssociationArn, name: "repositoryAssociationArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:association:[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
            try self.type.validate(name: "\(name).type")
        }

        private enum CodingKeys: String, CodingKey {
            case clientRequestToken = "ClientRequestToken"
            case name = "Name"
            case repositoryAssociationArn = "RepositoryAssociationArn"
            case type = "Type"
        }
    }

    public struct CreateCodeReviewResponse: AWSDecodableShape {
        public let codeReview: CodeReview?

        @inlinable
        public init(codeReview: CodeReview? = nil) {
            self.codeReview = codeReview
        }

        private enum CodingKeys: String, CodingKey {
            case codeReview = "CodeReview"
        }
    }

    public struct DescribeCodeReviewRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String

        @inlinable
        public init(codeReviewArn: String) {
            self.codeReviewArn = codeReviewArn
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.codeReviewArn, key: "CodeReviewArn")
        }

        public func validate(name: String) throws {
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, max: 1600)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, min: 1)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:[a-z-]+:[\\w-]+$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeCodeReviewResponse: AWSDecodableShape {
        /// Information about the code review.
        public let codeReview: CodeReview?

        @inlinable
        public init(codeReview: CodeReview? = nil) {
            self.codeReview = codeReview
        }

        private enum CodingKeys: String, CodingKey {
            case codeReview = "CodeReview"
        }
    }

    public struct DescribeRecommendationFeedbackRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String
        /// The recommendation ID that can be used to track the provided recommendations and then to collect the feedback.
        public let recommendationId: String
        /// Optional parameter to describe the feedback for a given user. If this is not supplied, it defaults to the user making the request.  The UserId is an IAM principal that can be specified as an Amazon Web Services account ID or an Amazon Resource Name (ARN). For  more information, see  Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
        public let userId: String?

        @inlinable
        public init(codeReviewArn: String, recommendationId: String, userId: String? = nil) {
            self.codeReviewArn = codeReviewArn
            self.recommendationId = recommendationId
            self.userId = userId
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.codeReviewArn, key: "CodeReviewArn")
            request.encodeQuery(self.recommendationId, key: "RecommendationId")
            request.encodeQuery(self.userId, key: "UserId")
        }

        public func validate(name: String) throws {
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, max: 1600)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, min: 1)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:[a-z-]+:[\\w-]+$")
            try self.validate(self.recommendationId, name: "recommendationId", parent: name, max: 64)
            try self.validate(self.recommendationId, name: "recommendationId", parent: name, min: 1)
            try self.validate(self.userId, name: "userId", parent: name, max: 256)
            try self.validate(self.userId, name: "userId", parent: name, min: 1)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeRecommendationFeedbackResponse: AWSDecodableShape {
        /// The recommendation feedback given by the user.
        public let recommendationFeedback: RecommendationFeedback?

        @inlinable
        public init(recommendationFeedback: RecommendationFeedback? = nil) {
            self.recommendationFeedback = recommendationFeedback
        }

        private enum CodingKeys: String, CodingKey {
            case recommendationFeedback = "RecommendationFeedback"
        }
    }

    public struct DescribeRepositoryAssociationRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
        public let associationArn: String

        @inlinable
        public init(associationArn: String) {
            self.associationArn = associationArn
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.associationArn, key: "AssociationArn")
        }

        public func validate(name: String) throws {
            try self.validate(self.associationArn, name: "associationArn", parent: name, max: 1600)
            try self.validate(self.associationArn, name: "associationArn", parent: name, min: 1)
            try self.validate(self.associationArn, name: "associationArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:association:[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DescribeRepositoryAssociationResponse: AWSDecodableShape {
        /// Information about the repository association.
        public let repositoryAssociation: RepositoryAssociation?
        /// An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
        /// 					Environment, Project, or Secret). Tag
        /// 					keys are case sensitive.   An optional field known as a tag value (for example,
        /// 					111122223333, Production, or a team name).
        /// 					Omitting the tag value is the same as using an empty string. Like tag keys, tag
        /// 					values are case sensitive.
        public let tags: [String: String]?

        @inlinable
        public init(repositoryAssociation: RepositoryAssociation? = nil, tags: [String: String]? = nil) {
            self.repositoryAssociation = repositoryAssociation
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case repositoryAssociation = "RepositoryAssociation"
            case tags = "Tags"
        }
    }

    public struct DisassociateRepositoryRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
        public let associationArn: String

        @inlinable
        public init(associationArn: String) {
            self.associationArn = associationArn
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.associationArn, key: "AssociationArn")
        }

        public func validate(name: String) throws {
            try self.validate(self.associationArn, name: "associationArn", parent: name, max: 1600)
            try self.validate(self.associationArn, name: "associationArn", parent: name, min: 1)
            try self.validate(self.associationArn, name: "associationArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:association:[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct DisassociateRepositoryResponse: AWSDecodableShape {
        /// Information about the disassociated repository.
        public let repositoryAssociation: RepositoryAssociation?
        /// An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
        /// 					Environment, Project, or Secret). Tag
        /// 					keys are case sensitive.   An optional field known as a tag value (for example,
        /// 					111122223333, Production, or a team name).
        /// 					Omitting the tag value is the same as using an empty string. Like tag keys, tag
        /// 					values are case sensitive.
        public let tags: [String: String]?

        @inlinable
        public init(repositoryAssociation: RepositoryAssociation? = nil, tags: [String: String]? = nil) {
            self.repositoryAssociation = repositoryAssociation
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case repositoryAssociation = "RepositoryAssociation"
            case tags = "Tags"
        }
    }

    public struct EventInfo: AWSEncodableShape & AWSDecodableShape {
        /// The name of the event. The possible names are pull_request, workflow_dispatch, schedule, and push
        public let name: String?
        /// The state of an event. The state might be open, closed, or another state.
        public let state: String?

        @inlinable
        public init(name: String? = nil, state: String? = nil) {
            self.name = name
            self.state = state
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, max: 32)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^[ \\-A-Z_a-z]+$")
            try self.validate(self.state, name: "state", parent: name, max: 32)
            try self.validate(self.state, name: "state", parent: name, min: 1)
            try self.validate(self.state, name: "state", parent: name, pattern: "^[ \\-A-Z_a-z]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
            case state = "State"
        }
    }

    public struct KMSKeyDetails: AWSEncodableShape & AWSDecodableShape {
        /// The encryption option for a repository association. It is either owned by Amazon Web Services Key Management Service (KMS) (AWS_OWNED_CMK) or customer managed (CUSTOMER_MANAGED_CMK).
        public let encryptionOption: EncryptionOption?
        /// The ID of the Amazon Web Services KMS key that is associated with a repository association.
        public let kmsKeyId: String?

        @inlinable
        public init(encryptionOption: EncryptionOption? = nil, kmsKeyId: String? = nil) {
            self.encryptionOption = encryptionOption
            self.kmsKeyId = kmsKeyId
        }

        public func validate(name: String) throws {
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, max: 2048)
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, min: 1)
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, pattern: "^[a-zA-Z0-9-]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case encryptionOption = "EncryptionOption"
            case kmsKeyId = "KMSKeyId"
        }
    }

    public struct ListCodeReviewsRequest: AWSEncodableShape {
        /// The maximum number of results that are returned per call. The default is 100.
        public let maxResults: Int?
        /// If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.
        public let nextToken: String?
        /// List of provider types for filtering that needs to be applied before displaying the result. For example, providerTypes=[GitHub] lists code reviews from GitHub.
        public let providerTypes: [ProviderType]?
        /// List of repository names for filtering that needs to be applied before displaying the result.
        public let repositoryNames: [String]?
        /// List of states for filtering that needs to be applied before displaying the result. For example, states=[Pending] lists code reviews in the Pending state. The valid code review states are:    Completed: The code review is complete.    Pending: The code review started and has not completed or failed.    Failed: The code review failed.    Deleting: The code review is being deleted.
        public let states: [JobState]?
        /// The type of code reviews to list in the response.
        public let type: `Type`

        @inlinable
        public init(maxResults: Int? = nil, nextToken: String? = nil, providerTypes: [ProviderType]? = nil, repositoryNames: [String]? = nil, states: [JobState]? = nil, type: `Type`) {
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.providerTypes = providerTypes
            self.repositoryNames = repositoryNames
            self.states = states
            self.type = type
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodeQuery(self.maxResults, key: "MaxResults")
            request.encodeQuery(self.nextToken, key: "NextToken")
            request.encodeQuery(self.providerTypes, key: "ProviderTypes")
            request.encodeQuery(self.repositoryNames, key: "RepositoryNames")
            request.encodeQuery(self.states, key: "States")
            request.encodeQuery(self.type, key: "Type")
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 2048)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.providerTypes, name: "providerTypes", parent: name, max: 3)
            try self.validate(self.providerTypes, name: "providerTypes", parent: name, min: 1)
            try self.repositoryNames?.forEach {
                try validate($0, name: "repositoryNames[]", parent: name, max: 100)
                try validate($0, name: "repositoryNames[]", parent: name, min: 1)
                try validate($0, name: "repositoryNames[]", parent: name, pattern: "^\\S[\\w.-]*$")
            }
            try self.validate(self.repositoryNames, name: "repositoryNames", parent: name, max: 100)
            try self.validate(self.repositoryNames, name: "repositoryNames", parent: name, min: 1)
            try self.validate(self.states, name: "states", parent: name, max: 3)
            try self.validate(self.states, name: "states", parent: name, min: 1)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListCodeReviewsResponse: AWSDecodableShape {
        /// A list of code reviews that meet the criteria of the request.
        public let codeReviewSummaries: [CodeReviewSummary]?
        /// Pagination token.
        public let nextToken: String?

        @inlinable
        public init(codeReviewSummaries: [CodeReviewSummary]? = nil, nextToken: String? = nil) {
            self.codeReviewSummaries = codeReviewSummaries
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case codeReviewSummaries = "CodeReviewSummaries"
            case nextToken = "NextToken"
        }
    }

    public struct ListRecommendationFeedbackRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String
        /// The maximum number of results that are returned per call. The default is 100.
        public let maxResults: Int?
        /// If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.
        public let nextToken: String?
        /// Used to query the recommendation feedback for a given recommendation.
        public let recommendationIds: [String]?
        /// An Amazon Web Services user's account ID or Amazon Resource Name (ARN). Use this ID to query the recommendation feedback for a code review from that user.  The UserId is an IAM principal that can be specified as an Amazon Web Services account ID or an Amazon Resource Name (ARN). For  more information, see  Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
        public let userIds: [String]?

        @inlinable
        public init(codeReviewArn: String, maxResults: Int? = nil, nextToken: String? = nil, recommendationIds: [String]? = nil, userIds: [String]? = nil) {
            self.codeReviewArn = codeReviewArn
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.recommendationIds = recommendationIds
            self.userIds = userIds
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.codeReviewArn, key: "CodeReviewArn")
            request.encodeQuery(self.maxResults, key: "MaxResults")
            request.encodeQuery(self.nextToken, key: "NextToken")
            request.encodeQuery(self.recommendationIds, key: "RecommendationIds")
            request.encodeQuery(self.userIds, key: "UserIds")
        }

        public func validate(name: String) throws {
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, max: 1600)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, min: 1)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:[a-z-]+:[\\w-]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 2048)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.recommendationIds?.forEach {
                try validate($0, name: "recommendationIds[]", parent: name, max: 64)
                try validate($0, name: "recommendationIds[]", parent: name, min: 1)
            }
            try self.validate(self.recommendationIds, name: "recommendationIds", parent: name, max: 100)
            try self.validate(self.recommendationIds, name: "recommendationIds", parent: name, min: 1)
            try self.userIds?.forEach {
                try validate($0, name: "userIds[]", parent: name, max: 256)
                try validate($0, name: "userIds[]", parent: name, min: 1)
            }
            try self.validate(self.userIds, name: "userIds", parent: name, max: 100)
            try self.validate(self.userIds, name: "userIds", parent: name, min: 1)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListRecommendationFeedbackResponse: AWSDecodableShape {
        /// If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.
        public let nextToken: String?
        /// Recommendation feedback summaries corresponding to the code review ARN.
        public let recommendationFeedbackSummaries: [RecommendationFeedbackSummary]?

        @inlinable
        public init(nextToken: String? = nil, recommendationFeedbackSummaries: [RecommendationFeedbackSummary]? = nil) {
            self.nextToken = nextToken
            self.recommendationFeedbackSummaries = recommendationFeedbackSummaries
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case recommendationFeedbackSummaries = "RecommendationFeedbackSummaries"
        }
    }

    public struct ListRecommendationsRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String
        /// The maximum number of results that are returned per call. The default is 100.
        public let maxResults: Int?
        /// Pagination token.
        public let nextToken: String?

        @inlinable
        public init(codeReviewArn: String, maxResults: Int? = nil, nextToken: String? = nil) {
            self.codeReviewArn = codeReviewArn
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.codeReviewArn, key: "CodeReviewArn")
            request.encodeQuery(self.maxResults, key: "MaxResults")
            request.encodeQuery(self.nextToken, key: "NextToken")
        }

        public func validate(name: String) throws {
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, max: 1600)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, min: 1)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:[a-z-]+:[\\w-]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 300)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 2048)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListRecommendationsResponse: AWSDecodableShape {
        /// Pagination token.
        public let nextToken: String?
        /// List of recommendations for the requested code review.
        public let recommendationSummaries: [RecommendationSummary]?

        @inlinable
        public init(nextToken: String? = nil, recommendationSummaries: [RecommendationSummary]? = nil) {
            self.nextToken = nextToken
            self.recommendationSummaries = recommendationSummaries
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case recommendationSummaries = "RecommendationSummaries"
        }
    }

    public struct ListRepositoryAssociationsRequest: AWSEncodableShape {
        /// The maximum number of repository association results returned by ListRepositoryAssociations in paginated output. When this parameter is used, ListRepositoryAssociations only returns maxResults results in a single page with a nextToken response element. The remaining results of the initial request can be seen by sending another ListRepositoryAssociations request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, ListRepositoryAssociations returns up to 100 results and a nextToken value if applicable.
        public let maxResults: Int?
        /// List of repository names to use as a filter.
        public let names: [String]?
        /// The nextToken value returned from a previous paginated ListRepositoryAssociations request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value.   Treat this token as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
        public let nextToken: String?
        /// List of owners to use as a filter. For Amazon Web Services CodeCommit, it is the name of the CodeCommit account that was used to associate the repository. For other repository source providers, such as Bitbucket and GitHub Enterprise Server, this is name of the account that was used to associate the repository.
        public let owners: [String]?
        /// List of provider types to use as a filter.
        public let providerTypes: [ProviderType]?
        /// List of repository association states to use as a filter. The valid repository association states are:    Associated: The repository association is complete.    Associating: CodeGuru Reviewer is:   Setting up pull request notifications. This is required  for pull requests to trigger a CodeGuru Reviewer review.  If your repository ProviderType is GitHub, GitHub Enterprise Server, or Bitbucket, CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.    Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.      Failed: The repository failed to associate or disassociate.    Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and source code access.    Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in anassociated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide.
        public let states: [RepositoryAssociationState]?

        @inlinable
        public init(maxResults: Int? = nil, names: [String]? = nil, nextToken: String? = nil, owners: [String]? = nil, providerTypes: [ProviderType]? = nil, states: [RepositoryAssociationState]? = nil) {
            self.maxResults = maxResults
            self.names = names
            self.nextToken = nextToken
            self.owners = owners
            self.providerTypes = providerTypes
            self.states = states
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodeQuery(self.maxResults, key: "MaxResults")
            request.encodeQuery(self.names, key: "Name")
            request.encodeQuery(self.nextToken, key: "NextToken")
            request.encodeQuery(self.owners, key: "Owner")
            request.encodeQuery(self.providerTypes, key: "ProviderType")
            request.encodeQuery(self.states, key: "State")
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.names?.forEach {
                try validate($0, name: "names[]", parent: name, max: 100)
                try validate($0, name: "names[]", parent: name, min: 1)
                try validate($0, name: "names[]", parent: name, pattern: "^\\S[\\w.-]*$")
            }
            try self.validate(self.names, name: "names", parent: name, max: 3)
            try self.validate(self.names, name: "names", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 2048)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.owners?.forEach {
                try validate($0, name: "owners[]", parent: name, max: 100)
                try validate($0, name: "owners[]", parent: name, min: 1)
                try validate($0, name: "owners[]", parent: name, pattern: "^\\S(.*\\S)?$")
            }
            try self.validate(self.owners, name: "owners", parent: name, max: 3)
            try self.validate(self.owners, name: "owners", parent: name, min: 1)
            try self.validate(self.providerTypes, name: "providerTypes", parent: name, max: 3)
            try self.validate(self.providerTypes, name: "providerTypes", parent: name, min: 1)
            try self.validate(self.states, name: "states", parent: name, max: 5)
            try self.validate(self.states, name: "states", parent: name, min: 1)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListRepositoryAssociationsResponse: AWSDecodableShape {
        /// The nextToken value to include in a future ListRecommendations request. When the results of a ListRecommendations request exceed maxResults, this value can be used to retrieve the next page of results. This value is null when there are no more results to return.
        public let nextToken: String?
        /// A list of repository associations that meet the criteria of the request.
        public let repositoryAssociationSummaries: [RepositoryAssociationSummary]?

        @inlinable
        public init(nextToken: String? = nil, repositoryAssociationSummaries: [RepositoryAssociationSummary]? = nil) {
            self.nextToken = nextToken
            self.repositoryAssociationSummaries = repositoryAssociationSummaries
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case repositoryAssociationSummaries = "RepositoryAssociationSummaries"
        }
    }

    public struct ListTagsForResourceRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
        public let resourceArn: String

        @inlinable
        public init(resourceArn: String) {
            self.resourceArn = resourceArn
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.resourceArn, key: "resourceArn")
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 1600)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:association:[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct ListTagsForResourceResponse: AWSDecodableShape {
        /// An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
        /// 					Environment, Project, or Secret). Tag
        /// 					keys are case sensitive.   An optional field known as a tag value (for example,
        /// 					111122223333, Production, or a team name).
        /// 					Omitting the tag value is the same as using an empty string. Like tag keys, tag
        /// 					values are case sensitive.
        public let tags: [String: String]?

        @inlinable
        public init(tags: [String: String]? = nil) {
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case tags = "Tags"
        }
    }

    public struct Metrics: AWSDecodableShape {
        /// Total number of recommendations found in the code review.
        public let findingsCount: Int64?
        ///  MeteredLinesOfCodeCount is the number of lines of code in the repository where the code review happened. This does not include non-code lines such as comments and blank lines.
        public let meteredLinesOfCodeCount: Int64?
        ///  SuppressedLinesOfCodeCount is the number of lines of code in the repository where the code review happened that CodeGuru Reviewer did not analyze. The lines suppressed in the analysis is based on the excludeFiles variable in the aws-codeguru-reviewer.yml file. This number does not include non-code lines such as comments and blank lines.
        public let suppressedLinesOfCodeCount: Int64?

        @inlinable
        public init(findingsCount: Int64? = nil, meteredLinesOfCodeCount: Int64? = nil, suppressedLinesOfCodeCount: Int64? = nil) {
            self.findingsCount = findingsCount
            self.meteredLinesOfCodeCount = meteredLinesOfCodeCount
            self.suppressedLinesOfCodeCount = suppressedLinesOfCodeCount
        }

        private enum CodingKeys: String, CodingKey {
            case findingsCount = "FindingsCount"
            case meteredLinesOfCodeCount = "MeteredLinesOfCodeCount"
            case suppressedLinesOfCodeCount = "SuppressedLinesOfCodeCount"
        }
    }

    public struct MetricsSummary: AWSDecodableShape {
        /// Total number of recommendations found in the code review.
        public let findingsCount: Int64?
        /// Lines of code metered in the code review. For the initial code review pull request and all subsequent revisions, this includes all lines of code in the files added to the pull request. In subsequent revisions, for files that already existed in the pull request, this includes only the changed lines of code. In both cases, this does not include non-code lines such as comments and import statements. For example, if you submit a pull request containing 5 files, each with 500 lines of code, and in a subsequent revision you added a new file with 200 lines of code, and also modified a total of 25 lines across the initial 5 files, MeteredLinesOfCodeCount includes the first 5 files (5 * 500 = 2,500 lines), the new file (200 lines) and the 25 changed lines of code for a total of 2,725 lines of code.
        public let meteredLinesOfCodeCount: Int64?
        /// Lines of code suppressed in the code review based on the excludeFiles element in the aws-codeguru-reviewer.yml file. For full repository analyses, this number includes all lines of code in the files that are suppressed. For pull requests, this number only includes the changed lines of code that are suppressed. In both cases, this number does not include non-code lines such as comments and import statements. For example, if you initiate a full repository analysis on a repository containing 5 files, each file with 100 lines of code, and 2 files are listed as excluded in the aws-codeguru-reviewer.yml file, then SuppressedLinesOfCodeCount returns 200 (2 * 100) as the total number of lines of code suppressed. However, if you submit a pull request for the same repository, then SuppressedLinesOfCodeCount only includes the lines in the 2 files that changed. If only 1 of the 2 files changed in the pull request, then SuppressedLinesOfCodeCount returns 100 (1 * 100) as the total number of lines of code suppressed.
        public let suppressedLinesOfCodeCount: Int64?

        @inlinable
        public init(findingsCount: Int64? = nil, meteredLinesOfCodeCount: Int64? = nil, suppressedLinesOfCodeCount: Int64? = nil) {
            self.findingsCount = findingsCount
            self.meteredLinesOfCodeCount = meteredLinesOfCodeCount
            self.suppressedLinesOfCodeCount = suppressedLinesOfCodeCount
        }

        private enum CodingKeys: String, CodingKey {
            case findingsCount = "FindingsCount"
            case meteredLinesOfCodeCount = "MeteredLinesOfCodeCount"
            case suppressedLinesOfCodeCount = "SuppressedLinesOfCodeCount"
        }
    }

    public struct PutRecommendationFeedbackRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String
        /// List for storing reactions. Reactions are utf-8 text code for emojis. If you send an empty list it clears all your feedback.
        public let reactions: [Reaction]
        /// The recommendation ID that can be used to track the provided recommendations and then to collect the feedback.
        public let recommendationId: String

        @inlinable
        public init(codeReviewArn: String, reactions: [Reaction], recommendationId: String) {
            self.codeReviewArn = codeReviewArn
            self.reactions = reactions
            self.recommendationId = recommendationId
        }

        public func validate(name: String) throws {
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, max: 1600)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, min: 1)
            try self.validate(self.codeReviewArn, name: "codeReviewArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:[a-z-]+:[\\w-]+$")
            try self.validate(self.reactions, name: "reactions", parent: name, max: 1)
            try self.validate(self.recommendationId, name: "recommendationId", parent: name, max: 64)
            try self.validate(self.recommendationId, name: "recommendationId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case codeReviewArn = "CodeReviewArn"
            case reactions = "Reactions"
            case recommendationId = "RecommendationId"
        }
    }

    public struct PutRecommendationFeedbackResponse: AWSDecodableShape {
        public init() {}
    }

    public struct RecommendationFeedback: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of the CodeReview object.
        public let codeReviewArn: String?
        /// The time at which the feedback was created.
        public let createdTimeStamp: Date?
        /// The time at which the feedback was last updated.
        public let lastUpdatedTimeStamp: Date?
        /// List for storing reactions. Reactions are utf-8 text code for emojis. You can send an empty list to clear off all your feedback.
        public let reactions: [Reaction]?
        /// The recommendation ID that can be used to track the provided recommendations. Later on it can be used to collect the feedback.
        public let recommendationId: String?
        /// The ID of the user that made the API call.  The UserId is an IAM principal that can be specified as an Amazon Web Services account ID or an Amazon Resource Name (ARN). For  more information, see  Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
        public let userId: String?

        @inlinable
        public init(codeReviewArn: String? = nil, createdTimeStamp: Date? = nil, lastUpdatedTimeStamp: Date? = nil, reactions: [Reaction]? = nil, recommendationId: String? = nil, userId: String? = nil) {
            self.codeReviewArn = codeReviewArn
            self.createdTimeStamp = createdTimeStamp
            self.lastUpdatedTimeStamp = lastUpdatedTimeStamp
            self.reactions = reactions
            self.recommendationId = recommendationId
            self.userId = userId
        }

        private enum CodingKeys: String, CodingKey {
            case codeReviewArn = "CodeReviewArn"
            case createdTimeStamp = "CreatedTimeStamp"
            case lastUpdatedTimeStamp = "LastUpdatedTimeStamp"
            case reactions = "Reactions"
            case recommendationId = "RecommendationId"
            case userId = "UserId"
        }
    }

    public struct RecommendationFeedbackSummary: AWSDecodableShape {
        /// List for storing reactions. Reactions are utf-8 text code for emojis.
        public let reactions: [Reaction]?
        /// The recommendation ID that can be used to track the provided recommendations. Later on it can be used to collect the feedback.
        public let recommendationId: String?
        /// The ID of the user that gave the feedback.  The UserId is an IAM principal that can be specified as an Amazon Web Services account ID or an Amazon Resource Name (ARN). For  more information, see  Specifying a Principal in the Amazon Web Services Identity and Access Management User Guide.
        public let userId: String?

        @inlinable
        public init(reactions: [Reaction]? = nil, recommendationId: String? = nil, userId: String? = nil) {
            self.reactions = reactions
            self.recommendationId = recommendationId
            self.userId = userId
        }

        private enum CodingKeys: String, CodingKey {
            case reactions = "Reactions"
            case recommendationId = "RecommendationId"
            case userId = "UserId"
        }
    }

    public struct RecommendationSummary: AWSDecodableShape {
        /// A description of the recommendation generated by CodeGuru Reviewer for the lines of code between the start line and the end line.
        public let description: String?
        /// Last line where the recommendation is applicable in the source commit or source branch. For a single line comment the start line and end line values are the same.
        public let endLine: Int?
        /// Name of the file on which a recommendation is provided.
        public let filePath: String?
        /// The type of a recommendation.
        public let recommendationCategory: RecommendationCategory?
        /// The recommendation ID that can be used to track the provided recommendations. Later on it can be used to collect the feedback.
        public let recommendationId: String?
        /// Metadata about a rule. Rule metadata includes an ID, a name, a list of tags, and a short and long description. CodeGuru Reviewer uses rules to analyze code. A rule's recommendation is included in analysis results if code is detected that violates the rule.
        public let ruleMetadata: RuleMetadata?
        /// The severity of the issue in the code that generated this recommendation.
        public let severity: Severity?
        /// Start line from where the recommendation is applicable in the source commit or source branch.
        public let startLine: Int?

        @inlinable
        public init(description: String? = nil, endLine: Int? = nil, filePath: String? = nil, recommendationCategory: RecommendationCategory? = nil, recommendationId: String? = nil, ruleMetadata: RuleMetadata? = nil, severity: Severity? = nil, startLine: Int? = nil) {
            self.description = description
            self.endLine = endLine
            self.filePath = filePath
            self.recommendationCategory = recommendationCategory
            self.recommendationId = recommendationId
            self.ruleMetadata = ruleMetadata
            self.severity = severity
            self.startLine = startLine
        }

        private enum CodingKeys: String, CodingKey {
            case description = "Description"
            case endLine = "EndLine"
            case filePath = "FilePath"
            case recommendationCategory = "RecommendationCategory"
            case recommendationId = "RecommendationId"
            case ruleMetadata = "RuleMetadata"
            case severity = "Severity"
            case startLine = "StartLine"
        }
    }

    public struct Repository: AWSEncodableShape {
        ///  Information about a Bitbucket repository.
        public let bitbucket: ThirdPartySourceRepository?
        /// Information about an Amazon Web Services CodeCommit repository.
        public let codeCommit: CodeCommitRepository?
        /// Information about a GitHub Enterprise Server repository.
        public let gitHubEnterpriseServer: ThirdPartySourceRepository?
        public let s3Bucket: S3Repository?

        @inlinable
        public init(bitbucket: ThirdPartySourceRepository? = nil, codeCommit: CodeCommitRepository? = nil, gitHubEnterpriseServer: ThirdPartySourceRepository? = nil, s3Bucket: S3Repository? = nil) {
            self.bitbucket = bitbucket
            self.codeCommit = codeCommit
            self.gitHubEnterpriseServer = gitHubEnterpriseServer
            self.s3Bucket = s3Bucket
        }

        public func validate(name: String) throws {
            try self.bitbucket?.validate(name: "\(name).bitbucket")
            try self.codeCommit?.validate(name: "\(name).codeCommit")
            try self.gitHubEnterpriseServer?.validate(name: "\(name).gitHubEnterpriseServer")
            try self.s3Bucket?.validate(name: "\(name).s3Bucket")
        }

        private enum CodingKeys: String, CodingKey {
            case bitbucket = "Bitbucket"
            case codeCommit = "CodeCommit"
            case gitHubEnterpriseServer = "GitHubEnterpriseServer"
            case s3Bucket = "S3Bucket"
        }
    }

    public struct RepositoryAnalysis: AWSEncodableShape {
        /// A SourceCodeType that specifies the tip of a branch in an associated repository.
        public let repositoryHead: RepositoryHeadSourceCodeType?
        public let sourceCodeType: SourceCodeType?

        @inlinable
        public init(repositoryHead: RepositoryHeadSourceCodeType? = nil, sourceCodeType: SourceCodeType? = nil) {
            self.repositoryHead = repositoryHead
            self.sourceCodeType = sourceCodeType
        }

        public func validate(name: String) throws {
            try self.repositoryHead?.validate(name: "\(name).repositoryHead")
            try self.sourceCodeType?.validate(name: "\(name).sourceCodeType")
        }

        private enum CodingKeys: String, CodingKey {
            case repositoryHead = "RepositoryHead"
            case sourceCodeType = "SourceCodeType"
        }
    }

    public struct RepositoryAssociation: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) identifying the repository association.
        public let associationArn: String?
        /// The ID of the repository association.
        public let associationId: String?
        /// The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id. For more information, see Connection in the Amazon Web Services CodeStar Connections API Reference.
        public let connectionArn: String?
        /// The time, in milliseconds since the epoch, when the repository association was created.
        public let createdTimeStamp: Date?
        /// A KMSKeyDetails object that contains:   The encryption option for this repository association. It is either owned by Amazon Web Services Key Management Service (KMS) (AWS_OWNED_CMK) or customer managed (CUSTOMER_MANAGED_CMK).   The ID of the Amazon Web Services KMS key that is associated with this repository association.
        public let kmsKeyDetails: KMSKeyDetails?
        /// The time, in milliseconds since the epoch, when the repository association was last updated.
        public let lastUpdatedTimeStamp: Date?
        /// The name of the repository.
        public let name: String?
        /// The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the  account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.
        public let owner: String?
        /// The provider type of the repository association.
        public let providerType: ProviderType?
        public let s3RepositoryDetails: S3RepositoryDetails?
        /// The state of the repository association. The valid repository association states are:    Associated: The repository association is complete.    Associating: CodeGuru Reviewer is:   Setting up pull request notifications. This is required  for pull requests to trigger a CodeGuru Reviewer review.  If your repository ProviderType is GitHub, GitHub Enterprise Server, or Bitbucket, CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.    Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.      Failed: The repository failed to associate or disassociate.    Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and source code access.    Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in anassociated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide.
        public let state: RepositoryAssociationState?
        /// A description of why the repository association is in the current state.
        public let stateReason: String?

        @inlinable
        public init(associationArn: String? = nil, associationId: String? = nil, connectionArn: String? = nil, createdTimeStamp: Date? = nil, kmsKeyDetails: KMSKeyDetails? = nil, lastUpdatedTimeStamp: Date? = nil, name: String? = nil, owner: String? = nil, providerType: ProviderType? = nil, s3RepositoryDetails: S3RepositoryDetails? = nil, state: RepositoryAssociationState? = nil, stateReason: String? = nil) {
            self.associationArn = associationArn
            self.associationId = associationId
            self.connectionArn = connectionArn
            self.createdTimeStamp = createdTimeStamp
            self.kmsKeyDetails = kmsKeyDetails
            self.lastUpdatedTimeStamp = lastUpdatedTimeStamp
            self.name = name
            self.owner = owner
            self.providerType = providerType
            self.s3RepositoryDetails = s3RepositoryDetails
            self.state = state
            self.stateReason = stateReason
        }

        private enum CodingKeys: String, CodingKey {
            case associationArn = "AssociationArn"
            case associationId = "AssociationId"
            case connectionArn = "ConnectionArn"
            case createdTimeStamp = "CreatedTimeStamp"
            case kmsKeyDetails = "KMSKeyDetails"
            case lastUpdatedTimeStamp = "LastUpdatedTimeStamp"
            case name = "Name"
            case owner = "Owner"
            case providerType = "ProviderType"
            case s3RepositoryDetails = "S3RepositoryDetails"
            case state = "State"
            case stateReason = "StateReason"
        }
    }

    public struct RepositoryAssociationSummary: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
        public let associationArn: String?
        /// The repository association ID.
        public let associationId: String?
        /// The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id. For more information, see Connection in the Amazon Web Services CodeStar Connections API Reference.
        public let connectionArn: String?
        /// The time, in milliseconds since the epoch, since the repository association was last updated.
        public let lastUpdatedTimeStamp: Date?
        /// The name of the repository association.
        public let name: String?
        /// The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the  account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.
        public let owner: String?
        /// The provider type of the repository association.
        public let providerType: ProviderType?
        /// The state of the repository association. The valid repository association states are:    Associated: The repository association is complete.    Associating: CodeGuru Reviewer is:   Setting up pull request notifications. This is required  for pull requests to trigger a CodeGuru Reviewer review.  If your repository ProviderType is GitHub, GitHub Enterprise Server, or Bitbucket, CodeGuru Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer reviews. If you delete these webhooks, reviews of code in your repository cannot be triggered.    Setting up source code access. This is required for CodeGuru Reviewer to securely clone code in your repository.      Failed: The repository failed to associate or disassociate.    Disassociating: CodeGuru Reviewer is removing the repository's pull request notifications and source code access.    Disassociated: CodeGuru Reviewer successfully disassociated the repository. You can create a new association with this repository if you want to review source code in it later. You can control access to code reviews created in anassociated repository with tags after it has been disassociated. For more information, see Using tags to control access to associated repositories in the Amazon CodeGuru Reviewer User Guide.
        public let state: RepositoryAssociationState?

        @inlinable
        public init(associationArn: String? = nil, associationId: String? = nil, connectionArn: String? = nil, lastUpdatedTimeStamp: Date? = nil, name: String? = nil, owner: String? = nil, providerType: ProviderType? = nil, state: RepositoryAssociationState? = nil) {
            self.associationArn = associationArn
            self.associationId = associationId
            self.connectionArn = connectionArn
            self.lastUpdatedTimeStamp = lastUpdatedTimeStamp
            self.name = name
            self.owner = owner
            self.providerType = providerType
            self.state = state
        }

        private enum CodingKeys: String, CodingKey {
            case associationArn = "AssociationArn"
            case associationId = "AssociationId"
            case connectionArn = "ConnectionArn"
            case lastUpdatedTimeStamp = "LastUpdatedTimeStamp"
            case name = "Name"
            case owner = "Owner"
            case providerType = "ProviderType"
            case state = "State"
        }
    }

    public struct RepositoryHeadSourceCodeType: AWSEncodableShape & AWSDecodableShape {
        /// The name of the branch in an associated repository. The RepositoryHeadSourceCodeType specifies the tip of this branch.
        public let branchName: String

        @inlinable
        public init(branchName: String) {
            self.branchName = branchName
        }

        public func validate(name: String) throws {
            try self.validate(self.branchName, name: "branchName", parent: name, max: 256)
            try self.validate(self.branchName, name: "branchName", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case branchName = "BranchName"
        }
    }

    public struct RequestMetadata: AWSEncodableShape & AWSDecodableShape {
        /// Information about the event associated with a code review.
        public let eventInfo: EventInfo?
        /// An identifier, such as a name or account ID, that is associated with the requester. The Requester is used to capture the author/actor name of the event request.
        public let requester: String?
        /// The ID of the request. This is required for a pull request code review.
        public let requestId: String?
        /// The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub repository, then the repository association's ProviderType is S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation.
        public let vendorName: VendorName?

        @inlinable
        public init(eventInfo: EventInfo? = nil, requester: String? = nil, requestId: String? = nil, vendorName: VendorName? = nil) {
            self.eventInfo = eventInfo
            self.requester = requester
            self.requestId = requestId
            self.vendorName = vendorName
        }

        public func validate(name: String) throws {
            try self.eventInfo?.validate(name: "\(name).eventInfo")
            try self.validate(self.requester, name: "requester", parent: name, max: 100)
            try self.validate(self.requester, name: "requester", parent: name, min: 1)
            try self.validate(self.requester, name: "requester", parent: name, pattern: "^\\S(.*\\S)?$")
            try self.validate(self.requestId, name: "requestId", parent: name, max: 64)
            try self.validate(self.requestId, name: "requestId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case eventInfo = "EventInfo"
            case requester = "Requester"
            case requestId = "RequestId"
            case vendorName = "VendorName"
        }
    }

    public struct RuleMetadata: AWSDecodableShape {
        /// A long description of the rule.
        public let longDescription: String?
        /// The ID of the rule.
        public let ruleId: String?
        /// The name of the rule.
        public let ruleName: String?
        /// Tags that are associated with the rule.
        public let ruleTags: [String]?
        /// A short description of the rule.
        public let shortDescription: String?

        @inlinable
        public init(longDescription: String? = nil, ruleId: String? = nil, ruleName: String? = nil, ruleTags: [String]? = nil, shortDescription: String? = nil) {
            self.longDescription = longDescription
            self.ruleId = ruleId
            self.ruleName = ruleName
            self.ruleTags = ruleTags
            self.shortDescription = shortDescription
        }

        private enum CodingKeys: String, CodingKey {
            case longDescription = "LongDescription"
            case ruleId = "RuleId"
            case ruleName = "RuleName"
            case ruleTags = "RuleTags"
            case shortDescription = "ShortDescription"
        }
    }

    public struct S3BucketRepository: AWSEncodableShape & AWSDecodableShape {
        /// An S3RepositoryDetails object that specifies the name of an S3 bucket and a CodeArtifacts object. The CodeArtifacts object includes the S3 object keys for a source code .zip file and for a build artifacts .zip file.
        public let details: S3RepositoryDetails?
        /// The name of the repository when the ProviderType is S3Bucket.
        public let name: String

        @inlinable
        public init(details: S3RepositoryDetails? = nil, name: String) {
            self.details = details
            self.name = name
        }

        public func validate(name: String) throws {
            try self.details?.validate(name: "\(name).details")
            try self.validate(self.name, name: "name", parent: name, max: 100)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^\\S[\\w.-]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case details = "Details"
            case name = "Name"
        }
    }

    public struct S3Repository: AWSEncodableShape {
        /// The name of the S3 bucket used for associating a new S3 repository. It must begin with codeguru-reviewer-.
        public let bucketName: String
        /// The name of the repository in the S3 bucket.
        public let name: String

        @inlinable
        public init(bucketName: String, name: String) {
            self.bucketName = bucketName
            self.name = name
        }

        public func validate(name: String) throws {
            try self.validate(self.bucketName, name: "bucketName", parent: name, max: 63)
            try self.validate(self.bucketName, name: "bucketName", parent: name, min: 3)
            try self.validate(self.bucketName, name: "bucketName", parent: name, pattern: "^\\S(.*\\S)?$")
            try self.validate(self.name, name: "name", parent: name, max: 100)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^\\S[\\w.-]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case bucketName = "BucketName"
            case name = "Name"
        }
    }

    public struct S3RepositoryDetails: AWSEncodableShape & AWSDecodableShape {
        /// The name of the S3 bucket used for associating a new S3 repository. It must begin with codeguru-reviewer-.
        public let bucketName: String?
        /// A CodeArtifacts object. The CodeArtifacts object includes the S3 object key for a source code .zip file and for a build artifacts .zip file that contains .jar or .class files.
        public let codeArtifacts: CodeArtifacts?

        @inlinable
        public init(bucketName: String? = nil, codeArtifacts: CodeArtifacts? = nil) {
            self.bucketName = bucketName
            self.codeArtifacts = codeArtifacts
        }

        public func validate(name: String) throws {
            try self.validate(self.bucketName, name: "bucketName", parent: name, max: 63)
            try self.validate(self.bucketName, name: "bucketName", parent: name, min: 3)
            try self.validate(self.bucketName, name: "bucketName", parent: name, pattern: "^\\S(.*\\S)?$")
            try self.codeArtifacts?.validate(name: "\(name).codeArtifacts")
        }

        private enum CodingKeys: String, CodingKey {
            case bucketName = "BucketName"
            case codeArtifacts = "CodeArtifacts"
        }
    }

    public struct SourceCodeType: AWSEncodableShape & AWSDecodableShape {
        /// A type of SourceCodeType that specifies a source branch name and a destination branch name in an associated repository.
        public let branchDiff: BranchDiffSourceCodeType?
        /// A SourceCodeType that specifies a commit diff created by a pull request on an associated repository.
        public let commitDiff: CommitDiffSourceCodeType?
        public let repositoryHead: RepositoryHeadSourceCodeType?
        /// Metadata that is associated with a code review. This applies to any type of code review supported by CodeGuru Reviewer. The RequestMetadaa field captures any event metadata. For example, it might capture metadata associated with an event trigger, such as a push or a pull request.
        public let requestMetadata: RequestMetadata?
        /// Information about an associated repository in an S3 bucket that includes its name and an S3RepositoryDetails object. The S3RepositoryDetails object includes the name of an S3 bucket, an S3 key for a source code .zip file, and an S3 key for a build artifacts .zip file. S3BucketRepository is required in SourceCodeType for S3BucketRepository based code reviews.
        public let s3BucketRepository: S3BucketRepository?

        @inlinable
        public init(branchDiff: BranchDiffSourceCodeType? = nil, commitDiff: CommitDiffSourceCodeType? = nil, repositoryHead: RepositoryHeadSourceCodeType? = nil, requestMetadata: RequestMetadata? = nil, s3BucketRepository: S3BucketRepository? = nil) {
            self.branchDiff = branchDiff
            self.commitDiff = commitDiff
            self.repositoryHead = repositoryHead
            self.requestMetadata = requestMetadata
            self.s3BucketRepository = s3BucketRepository
        }

        public func validate(name: String) throws {
            try self.branchDiff?.validate(name: "\(name).branchDiff")
            try self.commitDiff?.validate(name: "\(name).commitDiff")
            try self.repositoryHead?.validate(name: "\(name).repositoryHead")
            try self.requestMetadata?.validate(name: "\(name).requestMetadata")
            try self.s3BucketRepository?.validate(name: "\(name).s3BucketRepository")
        }

        private enum CodingKeys: String, CodingKey {
            case branchDiff = "BranchDiff"
            case commitDiff = "CommitDiff"
            case repositoryHead = "RepositoryHead"
            case requestMetadata = "RequestMetadata"
            case s3BucketRepository = "S3BucketRepository"
        }
    }

    public struct TagResourceRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
        public let resourceArn: String
        /// An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   A tag key (for example, CostCenter,
        /// 					Environment, Project, or Secret). Tag
        /// 					keys are case sensitive.   An optional field known as a tag value (for example,
        /// 					111122223333, Production, or a team name).
        /// 					Omitting the tag value is the same as using an empty string. Like tag keys, tag
        /// 					values are case sensitive.
        public let tags: [String: String]

        @inlinable
        public init(resourceArn: String, tags: [String: String]) {
            self.resourceArn = resourceArn
            self.tags = tags
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            var container = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.resourceArn, key: "resourceArn")
            try container.encode(self.tags, forKey: .tags)
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 1600)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:association:[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
            try self.tags.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
            }
            try self.validate(self.tags, name: "tags", parent: name, max: 50)
            try self.validate(self.tags, name: "tags", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case tags = "Tags"
        }
    }

    public struct TagResourceResponse: AWSDecodableShape {
        public init() {}
    }

    public struct ThirdPartySourceRepository: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of an Amazon Web Services CodeStar Connections connection. Its format is arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id. For more information, see Connection in the Amazon Web Services CodeStar Connections API Reference.
        public let connectionArn: String
        /// The name of the third party source repository.
        public let name: String
        /// The owner of the repository. For a GitHub, GitHub Enterprise, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, this can be the username or Amazon Web Services account ID
        public let owner: String

        @inlinable
        public init(connectionArn: String, name: String, owner: String) {
            self.connectionArn = connectionArn
            self.name = name
            self.owner = owner
        }

        public func validate(name: String) throws {
            try self.validate(self.connectionArn, name: "connectionArn", parent: name, max: 256)
            try self.validate(self.connectionArn, name: "connectionArn", parent: name, pattern: "^arn:aws(-[\\w]+)*:.+:.+:[0-9]{12}:.+$")
            try self.validate(self.name, name: "name", parent: name, max: 100)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^\\S[\\w.-]*$")
            try self.validate(self.owner, name: "owner", parent: name, max: 100)
            try self.validate(self.owner, name: "owner", parent: name, min: 1)
            try self.validate(self.owner, name: "owner", parent: name, pattern: "^\\S(.*\\S)?$")
        }

        private enum CodingKeys: String, CodingKey {
            case connectionArn = "ConnectionArn"
            case name = "Name"
            case owner = "Owner"
        }
    }

    public struct UntagResourceRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the RepositoryAssociation object. You can retrieve this ARN by calling ListRepositoryAssociations.
        public let resourceArn: String
        /// A list of the keys for each tag you want to remove from an associated repository.
        public let tagKeys: [String]

        @inlinable
        public init(resourceArn: String, tagKeys: [String]) {
            self.resourceArn = resourceArn
            self.tagKeys = tagKeys
        }

        public func encode(to encoder: Encoder) throws {
            let request = encoder.userInfo[.awsRequest]! as! RequestEncodingContainer
            _ = encoder.container(keyedBy: CodingKeys.self)
            request.encodePath(self.resourceArn, key: "resourceArn")
            request.encodeQuery(self.tagKeys, key: "tagKeys")
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 1600)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^arn:aws[^:\\s]*:codeguru-reviewer:[^:\\s]+:[\\d]{12}:association:[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
            try self.tagKeys.forEach {
                try validate($0, name: "tagKeys[]", parent: name, max: 128)
                try validate($0, name: "tagKeys[]", parent: name, min: 1)
            }
            try self.validate(self.tagKeys, name: "tagKeys", parent: name, max: 50)
            try self.validate(self.tagKeys, name: "tagKeys", parent: name, min: 1)
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct UntagResourceResponse: AWSDecodableShape {
        public init() {}
    }
}

// MARK: - Errors

/// Error enum for CodeGuruReviewer
public struct CodeGuruReviewerErrorType: AWSErrorType {
    enum Code: String {
        case accessDeniedException = "AccessDeniedException"
        case conflictException = "ConflictException"
        case internalServerException = "InternalServerException"
        case notFoundException = "NotFoundException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case throttlingException = "ThrottlingException"
        case validationException = "ValidationException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize CodeGuruReviewer
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// You do not have sufficient access to perform this action.
    public static var accessDeniedException: Self { .init(.accessDeniedException) }
    /// The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.
    public static var conflictException: Self { .init(.conflictException) }
    /// The server encountered an internal error and is unable to complete the request.
    public static var internalServerException: Self { .init(.internalServerException) }
    /// The resource specified in the request was not found.
    public static var notFoundException: Self { .init(.notFoundException) }
    ///  The resource specified in the request was not found.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// The request was denied due to request throttling.
    public static var throttlingException: Self { .init(.throttlingException) }
    /// The input fails to satisfy the specified constraints.
    public static var validationException: Self { .init(.validationException) }
}

extension CodeGuruReviewerErrorType: Equatable {
    public static func == (lhs: CodeGuruReviewerErrorType, rhs: CodeGuruReviewerErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension CodeGuruReviewerErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
